import axios from 'axios'
// import config from '../../server/config'

class Services {
  getCourseList(courseid) {
    return axios.get('/courses/'+ courseid + '/list')
  }

  postComment({commentid, tid, courseid, content}) {
    return axios.post('/courses/comment', {
      commentid,
      tid,
      courseid,
      content
    })
  }
  
  getComments({courseid, page}) {

    return courseid == 3001 ? axios.get('/learn/'+ courseid +'/comment?page=' + page) : axios.get('/courses/'+ courseid +'/comment?page=' + page)
  }

  postQuestion({courseid, videoid, topic, content}) {
    console.log('videoid: ' + videoid)
    return axios.post('/questions', {
      courseid,
      videoid,
      topic,
      content
    })
  }

  getQuestions({courseid='', page=1}) {
    return axios.get('/questions/' + courseid + '?page=' + page)
  }
}

export default new Services()